package com.example.lin.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import lombok.*;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author lzh
 * @since 2024-12-15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("sys_permission")
public class Permission implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 权限id
     */
    @TableId(value = "permission_id", type = IdType.AUTO)
    private Integer id;

    /**
     * 权限地址
     */
    @TableField("permission_path")
    private String path;

    /**
     * 权限路径
     */
    @TableField("permission_component")
    private String component;

    /**
     * 权限名称
     */
    @TableField("permission_label")
    private String label;

    /**
     * 权限图标
     */
    @TableField("permission_icon")
    private String icon;

    /**
     * 权限描述
     */
    @TableField("permission_description")
    private String description;

    /**
     * 权限类型(0-目录，1-菜单，2-按钮)
     */
    @TableField("permission_type")
    private Integer type;

    /**
     * 权限编码
     */
    @TableField("permission_code")
    private String code;

    /**
     * 父级权限id
     */
    @TableField("parent_id")
    private Integer parentId;

    /**
     * 创建人id
     */
    @TableField("created_by")
    private Long createdBy;

    /**
     * 修改人id
     */
    @TableField("updated_by")
    private Long updatedBy;

    /**
     * 排序(默认降序)
     */
    @TableField("order")
    private Integer order;

    /**
     * 创建时间
     */
    @TableField("created_time")
    private LocalDateTime createdTime;

    /**
     * 修改时间
     */
    @TableField("updated_time")
    private LocalDateTime updatedTime;

    /**
     * 是否启用(0-否，1-是)
     */
    @TableField("enabled")
    private Integer enabled;

    /**
     * 是否删除(0-否，1-是)
     */
    @TableField("deleted")
    @TableLogic
    private Integer deleted;

    @TableField(exist = false)
    private Object[] roles;

    @TableField(exist = false)
    private List<Permission> children;
}
